﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///UserInfo 的摘要说明
/// </summary>
public class UserHelper
{
    public  PKURG.CostSplit.Entities.SysUser GetCurrentUserInfo()
    {
        string Session_UserKey = "UserInfo";
        PKURG.CostSplit.Entities.SysUser _CurrentUserInfo;
        if (HttpContext.Current.Session[Session_UserKey] == null)
        {// @"founder\zhangweixing"; 
            string userName =HttpContext.Current.User.Identity.Name;
            //string userName = @"founder\lujiangfeng";
            _CurrentUserInfo = new PKURG.CostSplit.Services.SysUserService().GetByName(userName.ToLower());
            
            if (_CurrentUserInfo == null)
            {
                Common.GoNoPermissionPage();
            }
            else
            {
                HttpContext.Current.Session[Session_UserKey] = _CurrentUserInfo;
            }
        }
        else
        {
            _CurrentUserInfo = HttpContext.Current.Session[Session_UserKey] as PKURG.CostSplit.Entities.SysUser;
            //_CurrentUserInfo.Name = _CurrentUserInfo.Name+"C";
        }
        return _CurrentUserInfo;
    }
}